package com.example.mapper;

import com.example.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {

    @Select("select * from dept")
    List<Dept> selectAll();

    @Delete("delete from dept where id=#{id}")
    int deleteById(Integer id);

    @Insert("insert into dept values (null,#{name},#{createTime},#{updateTime})")
    @Options(useGeneratedKeys = true,keyProperty ="id")
    int addDept(Dept dept);

    @Select("select * from dept where id=#{id}")
    Dept selectById(Integer id);

    @Update("UPDATE dept SET name = #{name} WHERE id = #{id}")
    int updateDept(Dept dept);
}
